<html>
<head>
  <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  <title>Contents.m</title>
<link rel="stylesheet" type="text/css" href="../stpr.css">
</head>
<body>
<table  border=0 width="100%" cellpadding=0 cellspacing=0><tr valign="baseline">
<td valign="baseline" class="function"><b class="function">BAYESDF</b>
<td valign="baseline" align="right" class="function"><a href="../bayes/index.html" target="mdsdir"><img border = 0 src="../up.gif"></a></table>
  <p><b>Computes decision boundary of Bayesian classifier.</b></p>
  <hr>
<div class='code'><code>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Synopsis:</span></span><br>
<span class=help>&nbsp;&nbsp;quad_model&nbsp;=&nbsp;bayesdf(model)</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Description:</span></span><br>
<span class=help>&nbsp;&nbsp;This&nbsp;function&nbsp;computes&nbsp;parameters&nbsp;of&nbsp;decision&nbsp;boundary</span><br>
<span class=help>&nbsp;&nbsp;of&nbsp;the&nbsp;Bayesian&nbsp;classifier&nbsp;with&nbsp;the&nbsp;following&nbsp;assumptions:</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;-&nbsp;1/0&nbsp;loss&nbsp;function&nbsp;(risk&nbsp;=&nbsp;expectation&nbsp;of&nbsp;misclassification).</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;-&nbsp;Binary&nbsp;classification.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;-&nbsp;Class&nbsp;conditional&nbsp;probabilities&nbsp;are&nbsp;multivariate&nbsp;Gaussians.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;&nbsp;In&nbsp;this&nbsp;case&nbsp;the&nbsp;Bayesian&nbsp;classifier&nbsp;has&nbsp;the&nbsp;quadratic&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;discriminant&nbsp;function</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f(x)&nbsp;=&nbsp;x'*A*x&nbsp;+&nbsp;B'*x&nbsp;+&nbsp;C,</span><br>
<span class=help>&nbsp;&nbsp;</span><br>
<span class=help>&nbsp;&nbsp;where&nbsp;the&nbsp;classification&nbsp;strategy&nbsp;is</span><br>
<span class=help>&nbsp;&nbsp;q(x)&nbsp;=&nbsp;1&nbsp;&nbsp;if&nbsp;f(x)&nbsp;&gt;=&nbsp;0,</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;2&nbsp;&nbsp;if&nbsp;f(x)&nbsp;&lt;&nbsp;0.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Input:</span></span><br>
<span class=help>&nbsp;&nbsp;model&nbsp;[struct]&nbsp;Two&nbsp;multi-variate&nbsp;Gaussians:</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.Mean&nbsp;[dim&nbsp;x&nbsp;2]&nbsp;Mean&nbsp;values.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.Cov&nbsp;[dim&nbsp;x&nbsp;dim&nbsp;x&nbsp;2]&nbsp;Covariances.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.Prior&nbsp;[1x2]&nbsp;A&nbsp;priory&nbsp;probabilities.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Output:</span></span><br>
<span class=help>&nbsp;&nbsp;quad_model.A&nbsp;[dim&nbsp;x&nbsp;dim]&nbsp;Quadratic&nbsp;term.</span><br>
<span class=help>&nbsp;&nbsp;quad_model.B&nbsp;[dim&nbsp;x&nbsp;1]&nbsp;Linear&nbsp;term.</span><br>
<span class=help>&nbsp;&nbsp;quad_model.C&nbsp;[1x1]&nbsp;Bias.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Example:</span></span><br>
<span class=help>&nbsp;&nbsp;trn&nbsp;=&nbsp;load('riply_trn');</span><br>
<span class=help>&nbsp;&nbsp;tst&nbsp;=&nbsp;load('riply_trn');</span><br>
<span class=help>&nbsp;&nbsp;gauss_model&nbsp;=&nbsp;mlcgmm(trn);</span><br>
<span class=help>&nbsp;&nbsp;quad_model&nbsp;=&nbsp;bayesdf(gauss_model);</span><br>
<span class=help>&nbsp;&nbsp;ypred&nbsp;=&nbsp;quadclass(tst.X,quad_model);</span><br>
<span class=help>&nbsp;&nbsp;cerror(ypred,tst.y)</span><br>
<span class=help>&nbsp;&nbsp;figure;&nbsp;ppatterns(trn);&nbsp;pboundary(quad_model);&nbsp;</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=also_field>See also </span><span class=also></span><br>
<span class=help><span class=also>&nbsp;&nbsp;<a href = "../bayes/bayescls.html" target="mdsbody">BAYESCLS</a>,&nbsp;<a href = "../quadrat/quadclass.html" target="mdsbody">QUADCLASS</a></span><br>
<span class=help><span class=also></span><br>
</code></div>
  <hr>
  <b>Source:</b> <a href= "../bayes/list/bayesdf.html">bayesdf.m</a>
  <p><b class="info_field">About: </b>  Statistical Pattern Recognition Toolbox<br>
 (C) 1999-2003, Written by Vojtech Franc and Vaclav Hlavac<br>
 <a href="http://www.cvut.cz">Czech Technical University Prague</a><br>
 <a href="http://www.feld.cvut.cz">Faculty of Electrical Engineering</a><br>
 <a href="http://cmp.felk.cvut.cz">Center for Machine Perception</a><br>

  <p><b class="info_field">Modifications: </b> <br>
 18-oct-2005, VF, dealing with Cov given as vector repared<br>
 01-may-2004, VF<br>
 19-sep-2003, VF<br>
 24. 6.00 V. Hlavac, comments into English.<br>

</body>
</html>
